package com.tech.zhidengxian.util;


import com.tech.zhidengxian.model.dto.result.ResponseCode;
import com.tech.zhidengxian.util.exception.BizException;
import lombok.NoArgsConstructor;

/**
*@author Ljh
*@param
*@date 2022/7/20
*@description 通用断言类
*@return
**/
@NoArgsConstructor
public class ResultAssert {
    private final static double ZERO=0.0D;
    public static void assertNotNull(Object objects, String msg) {
        if (objects == null) {
            throw new BizException(ResponseCode.NOT_FIND_DATA,msg);
        }
    }
    public static void assertIsNull(Object objects, String msg) {
        if (objects != null) {
            throw new BizException(ResponseCode.BIZ_EXCEPTION,msg);
        }
    }
    public static void assertGreaterThanZero(Number flag, String msg) {
        if (flag.doubleValue() <= ZERO) {
            throw new BizException(ResponseCode.SYSTEM_EXCEPTION,msg);
        }
    }
}
